Repository navigation
fix(server): project memory recall is bounded and reports a timeout - #133
Merged
Merged
Conversation
The 150ms cutoff drops slow lookups before the tail or the ranked facts can be recorded. This replay calls the real recall path and writes the gate, the stage times, and the top candidates. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…acts A store read that never finishes returns null once 150ms passes. A newer fact that shares no term is still scored, and the lookup SQL uses the writer. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Recall now returns whether it attached facts, skipped, or omitted the lookup. The lookup reads at most 40 matching facts on the reader connection and stops after one second, and the turn still starts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
A thread that was shown the best matching facts, or that produced the closer ones, receives nothing when those facts fill the candidate limit. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
The candidate limit now drops facts this thread has seen or produced before it keeps forty, so a page of those facts no longer hides an older match. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
The live-data guard compares resolved strings, so a differently cased state path or a symlink into it is accepted. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
The guard follows the nearest existing directory and compares its identity, so a case change or a symlink cannot write results into the state directory. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
The test reads directory identity through the file stat. The realpath import stays, with the diagnostic off, because that is how a symlink resolves to the state directory. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…ound match equally Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
T3 Code saves project facts so a later agent can use them, and almost none arrive. Recall often passes 150 ms and returns nothing, with no log and no record. This change bounds the lookup and records a timeout when the lookup does not finish.
What changed
recall_failedomission, and the turn still starts.Scope
This covers recall arriving in time and a timeout that is visible. It leaves the relevance rule and explicit search as they are. How memory learns is a later change.
Tradeoffs
A stalled database can add up to 1 second before the turn starts. The bounded read on a reader should rarely reach that limit. The turn starts without facts, and the omission is on the delivery.
The 40 candidates are the best full-text matches among facts the thread can still receive, ordered by bm25 with ties broken by trust. A fact that the full ranking would place first can fall outside them when many near-duplicate facts quote the query. A reviewer built that case with 40 stale near-duplicates and one current decision. On the real export the delivered facts did not change. The next PR removes the native scorer from recall, after which the bound can be raised cheaply.
Blast Radius
Every provider turn that recalls project memory. Explicit search still uses the previous candidate set. On a replay of a real export, the delivered fact ids did not change.
Verification
🤖 Generated with Claude Code